<?php namespace Home\Controller;
use Hdphp\Controller\Controller;
use \Common\Model\Cate;
use \Common\Model\Goods;
use \Common\Model\GoodsAttr;

class GoodsController extends Controller{
	//构造函数
	public function __init()
	{
	}
	
	//动作
    public function index(){
    	
        View::make();
    }

//	商品详情页
	public function detail(){
		$gid=Q('get.gid',0,'intval');
		$goods = Db::table('goods')->join('detail','goods.gid','=','detail.gid')->where('goods.gid',$gid)->first();
		
		if($goods){
			//array_pop()
			$goods['small']=explode(',', rtrim($goods['small'],','));
			$goods['medium']=explode(',', rtrim($goods['medium'],','));
			$goods['big']=explode(',', rtrim($goods['big'],','));
			
		}
//		p($goods);
		View::with('goods',$goods);
		View::make();
	}
}
    
?>